package com.v1.video.fragment;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.umeng.analytics.MobclickAgent;
import com.v1.video.Constant;
import com.v1.video.R;
import com.v1.video.activity.AboutIdeaActivity;
import com.v1.video.activity.FriendDynamicsActivity;
import com.v1.video.activity.MyLoginSubscribeActivity;
import com.v1.video.activity.MyLoginVideoActivity;
import com.v1.video.activity.MyShouYiActivity;
import com.v1.video.activity.PersonInfoActivity;
import com.v1.video.activity.PersonalOptionActivity;
import com.v1.video.activity.SettingLoginActivity;
import com.v1.video.domain.LoginInfo;
import com.v1.video.domain.MyCenterInfo;
import com.v1.video.domain.MyloginVideoCountEntity;
import com.v1.video.domain.SetHead;
import com.v1.video.engine.NetEngine;
import com.v1.video.httpApi.V1VideoHttpApi;
import com.v1.video.httpmanager.RequestManager;
import com.v1.video.httpmanager.RequestManager.OnResponseListener;
import com.v1.video.util.Logger;

public class MainPageMyFragement extends V1BaseFragment {
	private boolean mIsDestory = false;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Log.i("fragment", "MainPageDiscoveryFragment-onCreate");
		mIsDestory = false;
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		Log.i("fragment", "MainPageDiscoveryFragment-onDestroy");
		mIsDestory = true;
		// if(taskMessage != null){//ft_12.22消息红点不要了，因为我的页里面的那两个不要了；
		// taskMessage.cancel(true);
		// }
	}

	private final String TAG = "MainPageMyFragement";

	private View rootView;

	private RelativeLayout layoutUserInfo = null;
	// private RelativeLayout layoutUserMsg = null;
	// private LinearLayout layoutUserAddFriend = null;
	/** 我的专辑 */
	// private RelativeLayout layoutUserAlbum = null;
	private RelativeLayout layoutUserShouyi = null;
	/** 设置 */
	private RelativeLayout layoutUserSetup = null;
	/** 好友动态 */
	private RelativeLayout layoutUserFriendMsg = null;
	
	/** 意见反馈 */
	private RelativeLayout layoutUserSuggestion = null;

	private TextView txtVideoNum = null;
	private TextView txtCollectNum = null;
	private TextView txtAttentionNum = null;
	private TextView txtFansNum = null;

	private ImageView userHead = null;
	private TextView txtUserName = null;
	private TextView txtUserDes = null;
	private ImageView userLevel = null;// V认证
	private ImageView userSex = null;
	private ImageView userBack = null;

	// private RelativeLayout messLayoutCount = null;//消息红点背景
	// private TextView messTxtCount = null;//消息红点数据
	private boolean isFirstLoad = true;// 是否首次加载
	// private GetMessageDataAsync taskMessage =
	// null;//ft_12.22消息红点不要了，因为我的页里面的那两个不要了；
	// private RelativeLayout mLayout_UnLogin;
	// private RelativeLayout mLayout_Login;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		rootView = inflater.inflate(R.layout.activity_my_mylogin, container,
				false);
		initView();
		initData();
		setListener();
		return rootView;
	}

	private void initView() {
		MobclickAgent.onEvent(this.getActivity(), Constant.MY_ID);
		// mLayout_UnLogin = (RelativeLayout)
		// rootView.findViewById(R.id.myUnlogin_user_bg);
		// mLayout_Login = (RelativeLayout)
		// rootView.findViewById(R.id.mylogin_user_bg);
		layoutUserInfo = (RelativeLayout) rootView
				.findViewById(R.id.mylogin_user_info_bg);
		// layoutUserMsg =
		// (RelativeLayout)rootView.findViewById(R.id.mylogin_message_bg);
		// layoutUserAddFriend =
		// (LinearLayout)rootView.findViewById(R.id.mylogin_add_friend_bg);
		// layoutUserAlbum =
		// (RelativeLayout)rootView.findViewById(R.id.mylogin_zhuanji_bg);
		layoutUserShouyi = (RelativeLayout) rootView
				.findViewById(R.id.mylogin_shouyi_bg);
		layoutUserSetup = (RelativeLayout) rootView
				.findViewById(R.id.mylogin_setup_bg);
		layoutUserFriendMsg = (RelativeLayout) rootView
				.findViewById(R.id.mylogin_friend_message);
		layoutUserSuggestion = (RelativeLayout) rootView
				.findViewById(R.id.mylogin_suggestion_bg);

		txtVideoNum = (TextView) rootView
				.findViewById(R.id.mylogin_user_video_num);
		txtCollectNum = (TextView) rootView
				.findViewById(R.id.mylogin_user_collect_num);
		txtAttentionNum = (TextView) rootView
				.findViewById(R.id.mylogin_user_attention_num);
		txtFansNum = (TextView) rootView
				.findViewById(R.id.mylogin_user_fans_num);

		userHead = (ImageView) rootView
				.findViewById(R.id.mylogin_user_head_img);
		txtUserName = (TextView) rootView
				.findViewById(R.id.mylogin_user_nickname);
		txtUserDes = (TextView) rootView
				.findViewById(R.id.mylogin_user_description);

		userLevel = (ImageView) rootView.findViewById(R.id.iv_user_level);
		userSex = (ImageView) rootView.findViewById(R.id.iv_sex);
		userBack = (ImageView) rootView
				.findViewById(R.id.mylogin_user_back_img);
		// messTxtCount = (TextView) rootView.findViewById(R.id.mess_txt_count);
		// messLayoutCount = (RelativeLayout)
		// rootView.findViewById(R.id.mess_itemcount_back);
	}

	private void initData() {

	}

	public void initDataOfResume() {
//		if (AppContext.getHeadBitmap() != null) {
//			userHead.setImageBitmap(Utils.toRoundBitmap(AppContext
//					.getHeadBitmap()));
//		} else {
			SetHead setHead = new SetHead();
			setHead.setHead(LoginInfo.getInstance().getUserImg(), LoginInfo
					.getInstance().getSex(), userHead);
//		}
		if (LoginInfo.getInstance().getSex().equals("女")) {
			userSex.setImageResource(R.drawable.icon_sex_woman);
		} else {
			userSex.setImageResource(R.drawable.icon_sex_man);
		}
		if (TextUtils.isEmpty(LoginInfo.getInstance().getNickName())
				|| LoginInfo.getInstance().getNickName().equals("null")) {
			txtUserName.setText(LoginInfo.getInstance().getUserName());
		} else {
			txtUserName.setText(LoginInfo.getInstance().getNickName());
		}
		setTextDetail(LoginInfo.getInstance().getDetail());
		if (LoginInfo.getInstance().getIsCertification().equals("1")) {
			userLevel.setVisibility(View.VISIBLE);
		} else {
			userLevel.setVisibility(View.GONE);
		}

		ImageLoader.getInstance().displayImage(
				LoginInfo.getInstance().getUserBackImg(), userBack,
				Constant.PERSONAL_HOME_OPTION, null);
		if (LoginInfo.getInstance().isLogin()) {
//			new GetDataAsync().execute();
			getUserCountInfo(getActivity(),0);
			getUserCountInfo(getActivity(),1);
			getUserCountInfo(getActivity(),2);
			getUserCountInfo(getActivity(),3);
		}
	}

	@Override
	public void onPause() {
		super.onPause();
		MobclickAgent.onPageEnd("我的");
	}

	@Override
	public void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		MobclickAgent.onPageStart("我的");
		if (LoginInfo.getInstance().isLogin()) {
			// mLayout_UnLogin.setVisibility(View.GONE);
			// mLayout_Login.setVisibility(View.VISIBLE);
			// layoutUserInfo.setVisibility(View.VISIBLE);
			userSex.setVisibility(View.VISIBLE);
			userLevel.setVisibility(View.VISIBLE);
			initData();
			initDataOfResume();

		} else {
			// mLayout_UnLogin.setVisibility(View.VISIBLE);
			// mLayout_Login.setVisibility(View.GONE);
			// layoutUserInfo.setVisibility(View.GONE);
			userSex.setVisibility(View.GONE);
			userLevel.setVisibility(View.GONE);
			txtUserName.setText(getResources().getString(
					R.string.main_my_unlogin_tologin));
			txtUserDes.setText(getResources().getString(
					R.string.main_my_unlogin_tologin_tips));
			userHead.setImageResource(R.drawable.anonymous_avatar);
			txtCollectNum.setText("0");
			txtFansNum.setText("0");
			txtVideoNum.setText("0");
			txtAttentionNum.setText("0");
			userBack.setImageResource(R.drawable.user_unlogin_bg);
		}
	}

	@Override
	public void onHiddenChanged(boolean hidden) {
		super.onHiddenChanged(hidden);
		// if(!hidden){
		// if(LoginInfo.getInstance().isLogin()){
		// new GetMessageDataAsync().execute();
		// } else {
		// if (messLayoutCount != null){
		// messLayoutCount.setVisibility(View.GONE);
		// }
		// }
		// }
	}

	private void setListener() {
		// userBack.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// // TODO Auto-generated method stub
		// if(LoginInfo.getInstance().isLogin()){
		// Intent inpersonal = new Intent();
		// inpersonal.setClass(getActivity(), PersonInfoActivity.class);
		// startActivity(inpersonal);
		// }
		// }
		// });
		// layoutUserInfo.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// Intent intentPerson = new Intent();
		// intentPerson.setClass(getActivity(), PersonalHomeActivity.class);
		// startActivity(intentPerson);
		// }
		// });
		layoutUserFriendMsg.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (LoginInfo.getInstance().isLogin()) {
					Intent intent = new Intent(getActivity(),
							FriendDynamicsActivity.class);
					startActivity(intent);
				} else {
					login();
				}
			}
		});
		
		layoutUserSuggestion.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(getActivity(), AboutIdeaActivity.class);
//				intent.setClass(getActivity(), VideoPlayerVRActivity.class);
//				ArrayList<String> listUrl = new ArrayList<String>();
//				
//				String url = "http://f04.v1.cn/site/14318177.mp4";
//				listUrl.add(url);
//				intent.putStringArrayListExtra("videourl", listUrl);
//				intent.putExtra("pos", 0);
				startActivity(intent);
			}
		});
		// layoutUserMsg.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// if(LoginInfo.getInstance().isLogin()){
		// Intent intent_message = new Intent(getActivity(),
		// SettingMessageActivity.class);
		// if (messLayoutCount != null)
		// messLayoutCount.setVisibility(View.GONE);
		// startActivity(intent_message);
		// MainPageNewActivity.closeMyRed();
		// } else {
		// login();
		// }
		// }
		// });

		// layoutUserAddFriend.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// if(LoginInfo.getInstance().isLogin()){
		// Intent requestfriend = new Intent(getActivity(),
		// SettingRequestGoodFriendActivity.class);
		// requestfriend.putExtra("userName", "我的");
		// requestfriend.putExtra("userId",
		// LoginInfo.getInstance().getUserId());
		// startActivity(requestfriend);
		// } else {
		// login();
		// }
		// }
		// });
		// layoutUserQuanZi.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// if(LoginInfo.getInstance().isLogin()){
		// Intent intent1 = new Intent(getActivity(),
		// ManageMyQuanziActivity.class);
		// intent1.putExtra("userName", "我的");
		// intent1.putExtra("userId", LoginInfo.getInstance().getUserId());
		// startActivity(intent1);
		// } else {
		// login();
		// }
		// }
		// });
		// layoutUserAlbum.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// if(LoginInfo.getInstance().isLogin()){
		// Intent intent2 = new Intent(getActivity(), MyZhuanjiActivity.class);
		// intent2.putExtra("userName", "我的专辑");
		// intent2.putExtra("userId", LoginInfo.getInstance().getUserId());
		// startActivity(intent2);
		//
		// } else {
		// login();
		// // Intent intent2 = new Intent(getActivity(),
		// WebViewActivity2.class);
		// // intent2.putExtra("adLink",
		// "http://www.v1.cn/active/m_buddhism_test.shtml");
		// // intent2.putExtra("adLink",
		// "http://www.v1.cn/live/lianghui-mlive/");
		// // intent2.putExtra("adLink", "http://www.v1.cn/ztm/dw/flive.html");
		// // intent2.putExtra("adLink",
		// "http://www.v1.cn/player/liveplayer/player/alive.html");
		// // intent2.putExtra("adLink", "http://www.v1.cn/live/");
		// // startActivity(intent2);
		//
		// }
		// }
		// });
		layoutUserShouyi.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				if (LoginInfo.getInstance().isLogin()) {
					Intent intent2 = new Intent(getActivity(),
							MyShouYiActivity.class);
					intent2.putExtra("userId", LoginInfo.getInstance()
							.getUserId());
					startActivity(intent2);
				} else {
					login();
//					 Intent intent2 = new Intent(getActivity(),
//					 WebViewActivity3.class);
////					 intent2.putExtra("adLink",
////							 "http://www.v1.cn/active/fc45.shtml");
//					 intent2.putExtra("adLink",
//							 "http://www.v1.cn/active/fjceshi.shtml");
////					 intent2.putExtra("adLink",
////					 "http://www.v1.cn/active/m_buddhism_test.shtml");
//					 // intent2.putExtra("adLink",
////					 "http://www.v1.cn/live/aomen-mlive/");
//					 // intent2.putExtra("adLink",
////					 "http://www.v1.cn/active/m_buddhism.shtml");
//					 // intent2.putExtra("adLink", "http://www.v1.cn/live/");
//					 startActivity(intent2);
				}
			}
		});
		layoutUserSetup.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub

				Intent intent_set = new Intent(getActivity(),
						PersonalOptionActivity.class);
				startActivity(intent_set);
//				Intent intent_set = new Intent(getActivity(),
//						WebViewActivity5.class);
//				intent_set.putExtra("adLink",
//					 "http://api.sso.v1.cn/paysuccess.html");
//				
//				startActivity(intent_set);
//				Intent intent_set = new Intent(getActivity(),
//						StarPetitionSupportActivity.class);
//				startActivity(intent_set);
				
				// Uri uri =
				// Uri.parse("http://www.v1.cn/active/m_buddhism.shtml");
				// Intent intent = new Intent(Intent.ACTION_VIEW,uri);
				// startActivity(intent);
//				String url = "http://king-hls.v1.cn/live/fjlive/index.m3u8";
//				Intent intent = new Intent(getActivity(), VideoPlayerActivityJin.class);
//                intent.putExtra("path", url);
//                startActivity(intent);

			}
		});
		rootView.findViewById(R.id.lay_video).setOnClickListener(// 视频
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						if (!LoginInfo.getInstance().isLogin()) {
							login();
						} else {
							Intent intent = new Intent();
							// intent.setClass(v.getContext(),
							// PersonalHomeActivity.class);
							// intent.putExtra("flag",
							// Constant.PERSONAL_VIDEO_FLAG);
							// startActivity(intent);
							intent.setClass(v.getContext(),
									MyLoginVideoActivity.class);
							intent.putExtra("title", "视频");
							startActivity(intent);
						}
					}
				});
		rootView.findViewById(R.id.lay_collect).setOnClickListener(// 收藏
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						if (!LoginInfo.getInstance().isLogin()) {
							login();
						} else {
							Intent intent = new Intent();
							// intent.setClass(v.getContext(),
							// PersonalHomeActivity.class);
							// intent.putExtra("flag",
							// Constant.PERSONAL_COLLECT_FLAG);
							intent.setClass(v.getContext(),
									MyLoginVideoActivity.class);
							intent.putExtra("title", "收藏");
							intent.putExtra(MyLoginVideoActivity.strFlag,
									MyLoginVideoActivity.FLAG_VIDEO_COLLECT);
							startActivity(intent);
						}
					}
				});
		rootView.findViewById(R.id.lay_attention).setOnClickListener(// 订阅
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						if (!LoginInfo.getInstance().isLogin()) {
							login();
						} else {
							Intent intent = new Intent();
							// intent.setClass(v.getContext(),
							// PersonalHomeActivity.class);
							// intent.putExtra("flag",
							// Constant.PERSONAL_ATTENTION_FLAG);
							intent.setClass(v.getContext(),
									MyLoginSubscribeActivity.class);
							intent.putExtra("title", "订阅");
							intent.putExtra(MyLoginSubscribeActivity.strFlag, MyLoginSubscribeActivity.FLAG_SUBSCRIBE);
							startActivity(intent);
						}
					}
				});
		rootView.findViewById(R.id.lay_fans).setOnClickListener(// 粉丝
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						if (!LoginInfo.getInstance().isLogin()) {
							login();
						} else {
							Intent intent = new Intent();
							// intent.setClass(v.getContext(),
							// PersonalHomeActivity.class);
							// intent.putExtra("flag",
							// Constant.PERSONAL_FANS_FLAG);
							intent.setClass(v.getContext(),
									MyLoginSubscribeActivity.class);
							intent.putExtra("title", "粉丝");
							intent.putExtra(MyLoginSubscribeActivity.strFlag, MyLoginSubscribeActivity.FLAG_FANS);
							startActivity(intent);
						}
					}
				});
		rootView.findViewById(R.id.mylogin_user_head_img).setOnClickListener(
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						if (!LoginInfo.getInstance().isLogin()) {
							login();
						} else {
							Intent inpersonal = new Intent();
							inpersonal.setClass(getActivity(),
									PersonInfoActivity.class);
							startActivity(inpersonal);
						}
					}
				});
	}

	private void login() {
		Intent intent_login = new Intent(getActivity(),
				SettingLoginActivity.class);
		intent_login.putExtra("loginFlag", 7);
		startActivityForResult(intent_login, Constant.REQUESTCODE_LOGIN_CODE);
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		switch (requestCode) {
		case Constant.REQUESTCODE_LOGIN_CODE:
			if (resultCode == Activity.RESULT_OK) {
				onResume();
			}
			break;
		default:
			break;
		}
	}

	@Override
	public void refresh(Object tag) {
		// TODO Auto-generated method stub

	}

	/**
	 * 获取用户视频等相关数据
	 */
	private class GetDataAsync extends AsyncTask<Void, Void, Boolean> {

		private String errorMsg = "";

		// private ProgressDialog pd;
		MyCenterInfo userNumInfo = null;

		public GetDataAsync() {

		}

		@Override
		protected void onPreExecute() {
			super.onPreExecute();
			// pd =
			// Utils.getProgressDialog(getActivity(),getResources().getString(R.string.get_data),
			// this);
			// pd.show();
		}

		@Override
		protected Boolean doInBackground(Void... params) {
			try {
				NetEngine engine = new NetEngine();
				userNumInfo = engine.getMyCenter(LoginInfo.getInstance()
						.getUserId());
				if (userNumInfo == null) {
					errorMsg = "获取数据失败！";
				}
			} catch (Exception e) {
				e.printStackTrace();
				errorMsg = e.getMessage();
			}
			return false;

		}

		// Uri uri = Uri.parse(versionInfo.url);
		// Intent it = new Intent(Intent.ACTION_VIEW,uri);
		// startActivity(it);
		@Override
		protected void onPostExecute(Boolean result) {
			super.onPostExecute(result);

			// if(pd != null && pd.isShowing()){
			// pd.cancel();
			// }

			if (mIsDestory)
				return;

			if (errorMsg.equals("") && userNumInfo != null) {
				if (userNumInfo.getReleaseCounts().equals("")) {
					txtVideoNum.setText("0");
				} else {
					txtVideoNum.setText(userNumInfo.getReleaseCounts());
				}
				if (userNumInfo.getCollectionCounts().equals("")) {
					txtCollectNum.setText("0");
				} else {
					txtCollectNum.setText(userNumInfo.getCollectionCounts());
				}
				if (userNumInfo.getFocusOnCounts().equals("")) {
					txtAttentionNum.setText("0");
				} else {
					txtAttentionNum.setText(userNumInfo.getFocusOnCounts());
				}
				if (userNumInfo.getFansCounts().equals("")) {
					txtFansNum.setText("0");
				} else {
					txtFansNum.setText(userNumInfo.getFansCounts());
				}

			} else {
//				ToastAlone.showToast(getActivity(), errorMsg, 1);
			}
		}
	}

	private void setTextDetail(String detail) {

		if (detail != null && !detail.equals("")) {
			// detailStr = detail;
			txtUserDes.setText(detail);
			// txtUserDes.setTextColor(getResources().getColor(R.color.gray_bg));
		} else {
			// detailStr = "";
			txtUserDes.setText("Ta很懒，什么都没说");
			// txtUserDes.setTextColor(getResources().getColor(R.color.dark_gray));
		}

	}	
	
	/**获取用户视频数*/
	public void getUserCountInfo(final Activity context,final int type){
		String url = "";//Constant.GET_USER_VIDEO_COUNT+"&uid="+LoginInfo.getInstance().getUserId()+"&devid="+Constant.DEVICEID;
		if(type == 0){
			url = V1VideoHttpApi.GET_USER_VIDEO_COUNT()+"&uid="+LoginInfo.getInstance().getUserId()+"&devid="+Constant.DEVICEID;
		}else if(type == 1){
			url = V1VideoHttpApi.GET_USER_ATTENTATION_COUNT()+"&uid="+LoginInfo.getInstance().getUserId()+"&devid="+Constant.DEVICEID;
		}else if(type == 2){
			url = V1VideoHttpApi.GET_USER_COLLECT_COUNT()+"&uid="+LoginInfo.getInstance().getUserId()+"&devid="+Constant.DEVICEID;
		}else if(type == 3){
			url = V1VideoHttpApi.GET_USER_FANS_COUNT()+"&uid="+LoginInfo.getInstance().getUserId()+"&devid="+Constant.DEVICEID;
		}
    	Logger.i(TAG, "用户视频数Url ="+url);
		RequestManager.getInstance().getRequest(context, url, null, MyloginVideoCountEntity.class, 0, "MainPageMyFragment", new OnResponseListener(){
			
			@Override
			public void onSuccess(Object object, int code, String message,String key) {
				// TODO Auto-generated method stub
				Logger.i(TAG, "onSuccess.object="+object.toString());
				
				if(object != null){
					MyloginVideoCountEntity entity = (MyloginVideoCountEntity)object;
					com.v1.video.domain.BaseEntity.Header header = entity.getHeader();
					if(header == null){
//						ToastAlone.showToast(context, "未知错误", Toast.LENGTH_SHORT);
						return ;
					}else if(!header.getStatus().equals("1")){
//						ToastAlone.showToast(context, header.getMessage(), Toast.LENGTH_SHORT);
						return;
					}else if(header.getStatus().equals("1")){
						if(entity.getBody() != null){
							
							if(entity.getBody().getData() != null){
								if(type == 0){
									txtVideoNum.setText(entity.getBody().getData());
								}else if(type == 1){
									txtAttentionNum.setText(entity.getBody().getData());
								}else if(type == 2){
									txtCollectNum.setText(entity.getBody().getData());
								}else if(type == 3){
									txtFansNum.setText(entity.getBody().getData());
								}
							}
							
						}else{
//							toast(header.getMessage());
						}
					}
				}
				
			}

			@Override
			public void onFailure(int code, String message) {
				// TODO Auto-generated method stub
				Logger.i(TAG, message);
				
			}
		});
		
		return ;
	}

}
